﻿# This is an example of an includable python script

# Here we define a function that calculates the powerlevel of a shaped pulse
def CalcPower(cPulse90, refShapeConst, calib90pulse, calibPower):
	reference_rect_pulse90 = 10.
	reference_rect_power_rf=50000.
	calibration_constant_db = 0.
	out_put = 120
	out_put = 20.*math.log10(refShapeConst*cPulse90/(calib90pulse))+calibPower
	return out_put

# Function that looks for a factor of presumably wave shape
# if not found returns 1.0
def GetWaveFactor(component_name):
	factor_name = component_name+".factor"
	try:
		return ExpScope.GetValue(factor_name)
	except:
		return 1.0
